function GSGamePlay () {
	var battle;
	
	var PADDING_V_W = 15;
	var PADDING_V_H = CANVAS_H;
	var PADDING_H_W = 1250;
	var PADDING_H_H = 9;
	var paddingBarV = g_graphicEngine.LoadImage("Data/ActionPhase/UI/PaddingBarV.png");
	var paddingBarH = g_graphicEngine.LoadImage("Data/ActionPhase/UI/PaddingBarH.png");
	
	var FORCE_BAR_W = 300;
	var FORCE_BAR_H = 30;
	var FORCE_BAR_X = 965;
	var FORCE_BAR_Y = 10;
	var forceBarE = g_graphicEngine.LoadImage("Data/ActionPhase/UI/ForceBarE.png");
	var forceBarF = g_graphicEngine.LoadImage("Data/ActionPhase/UI/ForceBarF.png");
	
	var HP_BAR_W = 300;
	var HP_BAR_H = 35;
	var HP_BAR_X = 20;
	var HP_BAR_Y = 7;
	var HPBarE = g_graphicEngine.LoadImage("Data/ActionPhase/UI/HPBarE.png");
	var HPBarF = g_graphicEngine.LoadImage("Data/ActionPhase/UI/HPBarF.png");
	
	var ENERGY_BAR_W = 300;
	var ENERGY_BAR_H = 35;
	var ENERGY_BAR_X = 370;
	var ENERGY_BAR_Y = 7;
	var energyBarE = g_graphicEngine.LoadImage("Data/ActionPhase/UI/EnergyBarE.png");
	var energyBarF = g_graphicEngine.LoadImage("Data/ActionPhase/UI/EnergyBarF.png");
	
	var VIRTUAL_CONTROLLER_ARROW_SIZE = 120;
	var VIRTUAL_CONTROLLER_ARROW_X = 30;
	var VIRTUAL_CONTROLLER_ARROW_Y = 340;
	var virtualControllerArrow = g_graphicEngine.LoadImage("Data/ActionPhase/UI/VirtualControllerArrow.png");
	
	var VIRTUAL_CONTROLLER_BOMB_SIZE = 180;
	var VIRTUAL_CONTROLLER_BOMB_X = 1080;
	var VIRTUAL_CONTROLLER_BOMB_Y = 530;
	var virtualControllerBomb = g_graphicEngine.LoadImage("Data/ActionPhase/UI/VirtualControllerBomb.png");
	
	var arrowNeedToDrawFullAlpha = 0;
	var skillNeedToDrawFullAlpha = 0;
	
	var mousePressingLeft = 0;
	var mousePressOnArrow = 0;
	var mousePressingRight = 0;
	var mousePressOnSkill = 0;
	

	this.Init = function () {
		battle = new Battle();
	}
	
	this.Update = function () {
		if (mousePressOnArrow > 0) {
			battle.OnKeyDown (mousePressOnArrow);
		}
		if (mousePressOnSkill > 0) {
			battle.OnKeyDown (mousePressOnSkill);
		}
		battle.Update();
	}
	
	this.Draw = function () {
		// Draw the map, the penguin, the enemy, the bomb, the explosion, everything.... first
		battle.Draw();
		
		// Draw 4 padding bar around the map
		g_graphicEngine.DrawFast (g_context, paddingBarV, 0, 0);
		g_graphicEngine.Draw (g_context, paddingBarV, 0, 0, PADDING_V_W, PADDING_V_H, CANVAS_W - PADDING_V_W, 0, PADDING_V_W, PADDING_V_H, 1, 1, 0, 0);
		g_graphicEngine.DrawFast (g_context, paddingBarH, PADDING_V_W, 0);
		g_graphicEngine.Draw (g_context, paddingBarH, 0, 0, PADDING_H_W, PADDING_H_H, PADDING_V_W, CANVAS_H - PADDING_H_H, PADDING_H_W, PADDING_H_H, 1, 0, 1, 0);
		
		
		// Draw the HP bar
		var HPFPercentage = battle.GetMyPenguinHPPercentage();
		var HPEPercentage = 1 - HPFPercentage;
		g_graphicEngine.Draw (g_context, HPBarE, (HPFPercentage * HP_BAR_W) >> 0, 0, (HP_BAR_W * HPEPercentage) >> 0, HP_BAR_H, HP_BAR_X + (HPFPercentage * HP_BAR_W) >> 0, HP_BAR_Y, (HP_BAR_W * HPEPercentage) >> 0, HP_BAR_H, 0.7);
		g_graphicEngine.Draw (g_context, HPBarF, 0, 0, (HP_BAR_W * HPFPercentage) >> 0, HP_BAR_H, HP_BAR_X, HP_BAR_Y, (HP_BAR_W * HPFPercentage) >> 0, HP_BAR_H, 0.7);
		
		// Draw the energy bar
		var energyFPercentage = battle.GetMyPenguinEnergyPercentage();
		var energyEPercentage = 1 - energyFPercentage;
		g_graphicEngine.Draw (g_context, energyBarE, (energyFPercentage * ENERGY_BAR_W) >> 0, 0, (ENERGY_BAR_W * energyEPercentage) >> 0, ENERGY_BAR_H, ENERGY_BAR_X + (energyFPercentage * ENERGY_BAR_W) >> 0, ENERGY_BAR_Y, (ENERGY_BAR_W * energyEPercentage) >> 0, ENERGY_BAR_H, 0.7);
		g_graphicEngine.Draw (g_context, energyBarF, 0, 0, (ENERGY_BAR_W * energyFPercentage) >> 0, ENERGY_BAR_H, ENERGY_BAR_X, ENERGY_BAR_Y, (ENERGY_BAR_W * energyFPercentage) >> 0, ENERGY_BAR_H, 0.7);
		
		// Draw the throw force bar
		var throwForceFPercentage = battle.GetThrowForcePercentage(); 
		var throwForceEPercentage = 1 - throwForceFPercentage;
		g_graphicEngine.Draw (g_context, forceBarE, (throwForceFPercentage * FORCE_BAR_W) >> 0, 0, (FORCE_BAR_W * throwForceEPercentage) >> 0, FORCE_BAR_H, FORCE_BAR_X + (throwForceFPercentage * FORCE_BAR_W) >> 0, FORCE_BAR_Y, (FORCE_BAR_W * throwForceEPercentage) >> 0, FORCE_BAR_H, 0.7);
		g_graphicEngine.Draw (g_context, forceBarF, 0, 0, (FORCE_BAR_W * throwForceFPercentage) >> 0, FORCE_BAR_H, FORCE_BAR_X, FORCE_BAR_Y, (FORCE_BAR_W * throwForceFPercentage) >> 0, FORCE_BAR_H, 0.7);
		
		
		
		
		
		
		
		
		
		
		
		
		
		if (arrowNeedToDrawFullAlpha == 37)
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 0, 0, 0);
		else 
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 0.7, 0, 0, 0);
		
		if (arrowNeedToDrawFullAlpha == 38)
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 0, 0, 90);
		else
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 0.7, 0, 0, 90);
		
		if (arrowNeedToDrawFullAlpha == 39)
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 1, 0, 0);
		else
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 0.7, 1, 0, 0);
		
		if (arrowNeedToDrawFullAlpha == 40)
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 1, 0, 90);
		else
			g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 0.7, 1, 0, 90);
			
		if (skillNeedToDrawFullAlpha == 32)
			g_graphicEngine.Draw (g_context, virtualControllerBomb, 0, 0, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_X, VIRTUAL_CONTROLLER_BOMB_Y, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, 1, 0, 0, 0);
		else 
			g_graphicEngine.Draw (g_context, virtualControllerBomb, 0, 0, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_X, VIRTUAL_CONTROLLER_BOMB_Y, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, 0.7, 0, 0, 0);
	}
	
	this.OnSwitch = function () {
	
	}
	
	this.OnMouseMove = function (x, y) {
		if (mousePressingLeft == true) {
			if (x < CANVAS_W * 0.5) {
				if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2
				&&  y >= VIRTUAL_CONTROLLER_ARROW_Y && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE) {
					mousePressOnArrow = 38;
				}
				else if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2 && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 3
				&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2) {
					mousePressOnArrow = 39;
				}
				else if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2
				&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2 && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 3) {
					mousePressOnArrow = 40;
				}
				else if (x >= VIRTUAL_CONTROLLER_ARROW_X && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE
				&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2) {
					mousePressOnArrow = 37;
				}
				else {
					mousePressOnArrow = 0;
				}
			}
		}
		else {
			mousePressOnArrow = 0;
		}
		
		if (mousePressingRight == true) {
			if (x >= CANVAS_W * 0.5) {
				if (x >= VIRTUAL_CONTROLLER_BOMB_X && x <= VIRTUAL_CONTROLLER_BOMB_X + VIRTUAL_CONTROLLER_BOMB_SIZE
				&&  y >= VIRTUAL_CONTROLLER_BOMB_Y && y <= VIRTUAL_CONTROLLER_BOMB_Y + VIRTUAL_CONTROLLER_BOMB_SIZE) {
					mousePressOnSkill = 32;
				}
				else {
					mousePressOnSkill = 0;
				}
			}
		}
		else {
			mousePressOnSkill = 0;
		}
		
		arrowNeedToDrawFullAlpha = mousePressOnArrow;
		skillNeedToDrawFullAlpha = mousePressOnSkill;
	}
	
	this.OnMouseDown = function (x, y) {
		if (x < CANVAS_W * 0.5) {
			mousePressingLeft = true;
		}
		else {
			mousePressingRight = true;
		}
		this.OnMouseMove (x, y);
	}
	
	this.OnMouseUp = function (x, y) {
		if (x < CANVAS_W * 0.5) {
			mousePressingLeft = false;
			battle.OnKeyUp (mousePressOnArrow);
			mousePressOnArrow = 0;
			arrowNeedToDrawFullAlpha = 0;
		}
		else {
			mousePressingRight = false;
			battle.OnKeyUp (mousePressOnSkill);
			mousePressOnSkill = 0;
			skillNeedToDrawFullAlpha = 0;
		}
	}
	
	this.OnMouseWheel = function (delta) {
	
	}
	
	
	var keycode1 = 0;
	var keycode2 = 0;
	
	this.OnKeyDown = function (keycode) {
		if (keycode >= 37 && keycode <= 40) {
			if (keycode == keycode1) return;
			if (keycode == keycode2) return;
			
			if (keycode1 == 0)	keycode1 = keycode;
			else 				keycode2 = keycode;
			
			battle.OnKeyDown (keycode);
			arrowNeedToDrawFullAlpha = keycode;
		}
		else if (keycode == 32) {
			battle.OnKeyDown (32);
			skillNeedToDrawFullAlpha = 32;
		}
	}
	
	this.OnKeyUp = function (keycode) {
		if (keycode >= 37 && keycode <= 40) {
			if (keycode1 == keycode) keycode1 = 0;
			if (keycode2 == keycode) keycode2 = 0;
			
			if (keycode1 >= 37 && keycode1 <= 40) {
				battle.OnKeyDown (keycode1);
				arrowNeedToDrawFullAlpha = keycode1;
			}
			else  {
				if (keycode2 >= 37 && keycode2 <= 40) {
					battle.OnKeyDown (keycode2);
					arrowNeedToDrawFullAlpha = keycode2;
				}
				else {                                  
					battle.OnKeyUp (keycode);
					arrowNeedToDrawFullAlpha = 0;
				}
			}
		}
		else if (keycode == 32) {
			battle.OnKeyUp(32);
			skillNeedToDrawFullAlpha = 0;
		}
	}
}